﻿<%@ Page Language="C#" AutoEventWireup="false" CodeFile="rptSanctionViewer.aspx.cs" Inherits="SIPO.Web.Reports.rptSanctionViewer" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Menu Form</title>
</head>
     <link type="text/css" rel="stylesheet" href="<%= ResolveUrl("~/styles/ui.jqgrid.css") %>" />
    <script type="text/javascript" src="<%= ResolveUrl("~/scripts/i18n/grid.locale-id.js") %>"></script>
    <script type="text/javascript" src="<%= ResolveUrl("~/scripts/jquery.jqGrid.min.js") %>"></script>
    <script src="<%= ResolveUrl("~/scripts/helper.js") %>" type="text/javascript"></script>
    <script type="text/javascript">
        $("#btnPrint").button({ icons: { primary: "ui-icon-print"} });

        $("#btnPrint").click(function () {
            var formUrl = '<%= ResolveUrl("~/reports/Transaction/rptPrintSanction.aspx") %>';
            var periodeAwal = $("#hfPeriodeAwal").val();
            var periodeAkhir = $("#hfPeriodeAkhir").val();
            var debtorID = $("#hfDebtorID").val();
            var sanctionTypeID = $("#hfSanctionTypeID").val();
            var isReview = $("#hfIsReview").val();
            var isApprove = $("#hfIsApprove").val();

            window.open(formUrl + "?periodeAwal=" + periodeAwal + "&periodeAkhir=" + periodeAkhir + "&debtorID=" + debtorID + "&sanctionTypeID=" + sanctionTypeID + "&isReview=" + isReview + "&isApprove=" + isApprove);

        });
    </script>

    <script type="text/javascript">

        var handlerUrl = '<%= ResolveUrl("~/Ajaxhandler/Transaction/recSanctionhandler.ashx") %>';

        $('#table').jqGrid({
            url: handlerUrl + "?method=getdatareport",
            postData: {
                PeriodeAwal: function () { return $("#hfPeriodeAwal").val() },
                PeriodeAkhir: function () { return $("#hfPeriodeAkhir").val() },
                DebtorID: function () { return $("#hfDebtorID").val() },
                SanctionTypeID: function () { return $("#hfSanctionTypeID").val() },
                IsReview: function () { return $("#hfIsReview").val() },
                IsApprove: function () { return $("#hfIsApprove").val() }
                
            },
            datatype: 'json',
            colNames: ['Debt. Sect. ID', 'Debitur ', 'Sektor', 'Sub Sektor','Sub Sub Sector', 'No. Surat', 'Tanggal Surat','Nama Lampiran','Value','tgl. Review','Review By','Tgl. Persetujuan','Disetujui Oleh'],
            colModel: [
           		{ name: 'DebtorSectorID', index: 'DebtorSectorID', align: 'center', searchoptions: { sopt: ['eq', 'cn'] }, width: 200 },
                { name: 'recDebtorSector.recDebtor.DebtorName', index: 'DebtorName', align: 'center', searchoptions: { sopt: ['eq', 'cn'] }, width: 300 },
                { name: 'recDebtorSector.recSector.SectorName', index: 'SectorName', align: 'center', searchoptions: { sopt: ['eq', 'cn'] }, width: 300 },
                { name: 'recDebtorSector.recSubSector.SubSectorName', index: 'SubSectorName', align: 'center', searchoptions: { sopt: ['eq', 'cn'] }, width: 300 },
                { name: 'recDebtorSector.recSubSubSector.SubSubSectorName', index: 'SubSubSectorName', align: 'center', searchoptions: { sopt: ['eq', 'cn'] }, width: 300 },
                { name: 'LetterNo', index: 'LetterNo', align: 'center', searchoptions: { sopt: ['eq', 'cn'] }, width: 200 },
                { name: 'LetterDate', index: 'LetterDate', align: 'center', width: 300, formatter: 'date', formatoptions: { newformat: 'd M Y'} },
                { name: 'AttachedFileName', index: 'AttachedFileName', align: 'left', searchoptions: { sopt: ['eq', 'cn'] }, width: 300 },
                { name: 'Value', index: 'Value', width: 200, formatter: 'currency', formatoptions: { prefix: '', suffix: '', thousandsSeparator: ',' }, align: 'right' },
                { name: 'ReviewDate', index: 'ReviewDate', align: 'center', width: 300, formatter: 'date', formatoptions: { newformat: 'd M Y'} },
                { name: 'ReviewBy', index: 'ReviewBy', align: 'center', searchoptions: { sopt: ['eq', 'cn'] }, width: 300 },
                { name: 'ApproveDate', index: 'ApproveDate', align: 'center', width: 300, formatter: 'date', formatoptions: { newformat: 'd M Y'} },
                { name: 'ApproveBy', index: 'ApproveBy', align: 'center', searchoptions: { sopt: ['eq', 'cn'] }, width: 300 }
           	],
            rowNum: 10,
            id: 'SanctionID',
            multiselect: false,
            rowList: [5, 10, 15, 20],
            pager: '#pager',
            sortname: 'recSanction.DebtorSectorID',
            sortorder: "asc",
            viewrecords: true,
            jsonReader: { repeatitems: false },
            width: 1150,
            height: '100%',
            caption: 'Aksi',
            ajaxGridOptions: { cache: false }

        });

        $("#table").jqGrid('navGrid', '#pager', { edit: false, add: false, del: false, refreshtext: 'Refresh' },
        {}, {}, {}, { closeOnEscape: true, multipleSearch: false, closeAfterSearch: false });
        </script>
<body>
    <form id="form1" runat="server">
    <div>
        <button id="btnPrint" type="button">Cetak</button>
    </div>
    <br />
    
    <table id="table" class="scroll" cellpadding="0" cellspacing="0">
    </table>
    <div id="pager" class="scroll">
    </div>
    <asp:HiddenField ID="hfPeriodeAwal" runat="server" />
    <asp:HiddenField ID="hfPeriodeAkhir" runat="server" />
    <asp:HiddenField ID="hfDebtorID" runat="server" />
    <asp:HiddenField ID="hfSanctionTypeID" runat="server" />
    <asp:HiddenField ID="hfIsReview" runat="server" />
    <asp:HiddenField ID="hfIsApprove" runat="server" />
    </form>
</body>
</html>
